package com.ve.clexer;

import java.io.*;

public class Main  {
	
	public LexerSpannerAdapter lexer;
	public static String readCode(File f) {
		StringBuilder sb=new StringBuilder();
		try {
			InputStreamReader inputReader = new InputStreamReader(new FileInputStream(f));
			BufferedReader bufReader = new BufferedReader(inputReader);
			String buff="";
			while ((buff = bufReader.readLine()) != null) {
				sb.append(buff).append('\n');
			}
			inputReader.close();
			bufReader.close();
		} catch (Exception e) {}
		return sb.toString();
	}
	
	long start;
	public void start(){
		start=System.currentTimeMillis();
		lexer=new LexerSpannerAdapter();
		File file=new File("D:\\Development\\Project_AndroidStudio\\C51\\app\\src\\main\\assets\\ltest.c");
		
		char data[]=readCode(file).toCharArray();
		System.out.println("Read succeed! [ " + (System.currentTimeMillis() - start) + " ms ]"+"["+data.length+" length]");
		
		start=System.currentTimeMillis();
		
		
		/*
		
		lexer.setData(data);
		lexer.lex();
		*/
		
		System.out.println("Lex: [ " + (System.currentTimeMillis() - start) + " ms ]");

		
	}
	
	
	
	public static void main(String[] args) {
		
		new Main().start();
		
	}
}
